<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>echarts快速上手 | html5中文文档</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-search/search.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../../md/echarts/lesson3.html" />
    
    
    <link rel="prev" href="../../md/echarts/lesson1.html" />
    

        
    </head>
    <body>
        
        
    <div class="book"
        data-level="2.1"
        data-chapter-title="echarts快速上手"
        data-filepath="md/echarts/lesson2.md"
        data-basepath="../.."
        data-revision="Fri Dec 14 2018 11:56:27 GMT+0800 (中国标准时间)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        Introduction
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="md/html/html.html">
            
                
                    <a href="../../md/html/html.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        html5的介绍
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="md/html/hbuilder的使用.html">
            
                
                    <a href="../../md/html/hbuilder的使用.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        开发工具的使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="md/html/lesson0.html">
            
                
                    <a href="../../md/html/lesson0.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        html5的介绍和结构分析
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="md/html/lesson1.html">
            
                
                    <a href="../../md/html/lesson1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        常用标签
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="md/html/lesson2.html">
            
                
                    <a href="../../md/html/lesson2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.</b>
                        
                        图片音频视频
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="md/html/lesson3.html">
            
                
                    <a href="../../md/html/lesson3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.</b>
                        
                        列表表格
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="md/html/lesson4.html">
            
                
                    <a href="../../md/html/lesson4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.6.</b>
                        
                        表单元素
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="md/html/lesson5.html">
            
                
                    <a href="../../md/html/lesson5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.7.</b>
                        
                        h5新增特性
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="md/html/lesson6.html">
            
                
                    <a href="../../md/html/lesson6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.8.</b>
                        
                        h5新增特性
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="md/html/lesson7.html">
            
                
                    <a href="../../md/html/lesson7.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.9.</b>
                        
                        h5新增特性
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="md/echarts/lesson1.html">
            
                
                    <a href="../../md/echarts/lesson1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        echarts的介绍
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="2.1" data-path="md/echarts/lesson2.html">
            
                
                    <a href="../../md/echarts/lesson2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        echarts快速上手
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="md/echarts/lesson3.html">
            
                
                    <a href="../../md/echarts/lesson3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        echarts常用组件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="md/echarts/lesson4.html">
            
                
                    <a href="../../md/echarts/lesson4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        echarts常用图表
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../../" >html5中文文档</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="echarts&#x7684;&#x57FA;&#x672C;&#x4F7F;&#x7528;">echarts&#x7684;&#x57FA;&#x672C;&#x4F7F;&#x7528;</h1>
<h2 id="&#x4E00;&#x3001;&#x5F15;&#x5165;echarts">&#x4E00;&#x3001;&#x5F15;&#x5165;echarts</h2>
<p>&#x53EA;&#x9700;&#x8981;&#x50CF;&#x666E;&#x901A;&#x7684;JavaScript&#x5E93;&#x4E00;&#x6837;&#x7528;script&#x6807;&#x7B7E;&#x5F15;&#x5165;&#x5373;&#x53EF;</p>
<p><a href="http://echarts.baidu.com/download.html" target="_blank">&#x70B9;&#x51FB;&#x4E0B;&#x8F7D;echarts</a></p>
<pre><code class="lang-html">    <span class="hljs-comment">&lt;!-- &#x5F15;&#x5165; ECharts &#x6587;&#x4EF6; --&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-title">script</span> <span class="hljs-attribute">src</span>=<span class="hljs-value">&quot;echarts.min.js&quot;</span>&gt;</span><span class="undefined"></span><span class="hljs-tag">&lt;/<span class="hljs-title">script</span>&gt;</span>
    <span class="hljs-comment">&lt;!-- &#x6216;&#x8005;&#x5F15;&#x5165; ECharts &#x5728;&#x7EBF;&#x5730;&#x5740; --&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-title">script</span> <span class="hljs-attribute">src</span>=<span class="hljs-value">&quot;https://cdn.bootcss.com/echarts/4.2.0-rc.2/echarts-en.common.min.js&quot;</span>&gt;</span><span class="undefined"></span><span class="hljs-tag">&lt;/<span class="hljs-title">script</span>&gt;</span>
</code></pre>
<h2 id="&#x4E8C;&#x3001;&#x7ED8;&#x5236;&#x4E00;&#x4E2A;&#x7B80;&#x5355;&#x7684;&#x56FE;&#x8868;">&#x4E8C;&#x3001;&#x7ED8;&#x5236;&#x4E00;&#x4E2A;&#x7B80;&#x5355;&#x7684;&#x56FE;&#x8868;</h2>
<p>&#x7ED8;&#x5236;&#x4E00;&#x4E2A;&#x56FE;&#x8868;&#x6211;&#x4EEC;&#x53EA;&#x9700;&#x4E09;&#x6B65;&#xFF1A;</p>
<ol>
<li>&#x7B2C;&#x4E00;&#x6B65;&#xFF1A;&#x57FA;&#x4E8E;&#x51C6;&#x5907;&#x597D;&#x7684;dom&#xFF0C;&#x901A;&#x8FC7;echarts.init()&#x521D;&#x59CB;&#x5316;echarts&#x5B9E;&#x4F8B;</li>
<li>&#x7B2C;&#x4E8C;&#x6B65;&#xFF1A; &#x6307;&#x5B9A;&#x56FE;&#x8868;&#x7684;&#x914D;&#x7F6E;&#x9879;&#x548C;&#x6570;&#x636E;</li>
<li>&#x7B2C;&#x4E09;&#x6B65;&#xFF1A; &#x901A;&#x8FC7;setOption&#x4F7F;&#x7528;&#x521A;&#x6307;&#x5B9A;&#x7684;&#x914D;&#x7F6E;&#x9879;&#x548C;&#x6570;&#x636E;&#x663E;&#x793A;&#x56FE;&#x8868;&#x3002;</li>
</ol>
<h2 id="&#x5B9E;&#x4F8B;">&#x5B9E;&#x4F8B;</h2>
<pre><code class="lang-html"><span class="hljs-doctype">&lt;!DOCTYPE html&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">html</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">head</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-title">meta</span> <span class="hljs-attribute">charset</span>=<span class="hljs-value">&quot;utf-8&quot;</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-title">title</span>&gt;</span>ECharts<span class="hljs-tag">&lt;/<span class="hljs-title">title</span>&gt;</span>
    <span class="hljs-comment">&lt;!-- &#x5F15;&#x5165; echarts.js --&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-title">script</span> <span class="hljs-attribute">src</span>=<span class="hljs-value">&quot;https://cdn.bootcss.com/echarts/4.2.0-rc.2/echarts-en.common.min.js&quot;</span>&gt;</span><span class="undefined"></span><span class="hljs-tag">&lt;/<span class="hljs-title">script</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">head</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">body</span>&gt;</span>
    <span class="hljs-comment">&lt;!-- &#x4E3A;ECharts&#x51C6;&#x5907;&#x4E00;&#x4E2A;&#x5177;&#x5907;&#x5927;&#x5C0F;&#x7684;Dom&#x5BB9;&#x5668; --&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">id</span>=<span class="hljs-value">&quot;main&quot;</span> <span class="hljs-attribute">style</span>=<span class="hljs-value">&quot;width: 600px;height:400px;&quot;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-title">script</span> <span class="hljs-attribute">type</span>=<span class="hljs-value">&quot;text/javascript&quot;</span>&gt;</span><span class="javascript">
        <span class="hljs-comment">// &#x7B2C;&#x4E00;&#x6B65;&#xFF1A;&#x57FA;&#x4E8E;&#x51C6;&#x5907;&#x597D;&#x7684;dom&#xFF0C;&#x521D;&#x59CB;&#x5316;echarts&#x5B9E;&#x4F8B;</span>
        <span class="hljs-keyword">var</span> myChart = echarts.init(<span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">&apos;main&apos;</span>));

        <span class="hljs-comment">// &#x7B2C;&#x4E8C;&#x6B65;&#xFF1A; &#x6307;&#x5B9A;&#x56FE;&#x8868;&#x7684;&#x914D;&#x7F6E;&#x9879;&#x548C;&#x6570;&#x636E;</span>
            <span class="hljs-keyword">var</span> option = {
                title:{             <span class="hljs-comment">//&#x8BBE;&#x7F6E;&#x56FE;&#x8868;&#x7684;&#x6807;&#x9898;&#x76F8;&#x5173;&#x5185;&#x5BB9;</span>
                    text:<span class="hljs-string">&quot;&#x6D4B;&#x8BD5;&quot;</span>,          <span class="hljs-comment">//&#x56FE;&#x8868;&#x6807;&#x9898;</span>
                    subtext:<span class="hljs-string">&quot;&#x672C;&#x6570;&#x636E;&#x7EAF;&#x5C5E;&#x865A;&#x6784;&quot;</span> <span class="hljs-comment">//&#x526F;&#x6807;&#x9898;</span>
                },
                tooltip:{},            <span class="hljs-comment">//&#x6C14;&#x6CE1;&#x63D0;&#x793A;&#x6846;&#xFF0C;&#x5E38;&#x7528;&#x4E8E;&#x5C55;&#x793A;&#x66F4;&#x8BE6;&#x7EC6;&#x7684;&#x6570;&#x636E;</span>
                legend:{            <span class="hljs-comment">//&#x56FE;&#x4F8B;&#xFF0C;&#x8868;&#x793A;&#x6570;&#x636E;&#x548C;&#x56FE;&#x8868;&#x7684;&#x5173;&#x8054;</span>
                    data:[<span class="hljs-string">&apos;&#x9500;&#x91CF;&apos;</span>]
                },
                xAxis:{                <span class="hljs-comment">//&#x76F4;&#x89D2;&#x5750;&#x6807;&#x7CFB;&#x4E2D;&#x7684;&#x6A2A;&#x8F74;&#xFF0C;&#x901A;&#x5E38;&#x9ED8;&#x8BA4;&#x4E3A;&#x7C7B;&#x76EE;&#x578B;</span>
                    data:[<span class="hljs-string">&quot;&#x886C;&#x886B;&quot;</span>,<span class="hljs-string">&quot;&#x7F8A;&#x6BDB;&#x886B;&quot;</span>,<span class="hljs-string">&quot;&#x88E4;&#x5B50;&quot;</span>]
                },
                yAxis:{},            <span class="hljs-comment">//&#x76F4;&#x89D2;&#x5750;&#x6807;&#x7CFB;&#x4E2D;&#x7684;&#x7EB5;&#x8F74;&#xFF0C;&#x901A;&#x5E38;&#x9ED8;&#x8BA4;&#x4E3A;&#x6570;&#x503C;&#x578B;</span>
                series:[{            <span class="hljs-comment">//&#x6570;&#x636E;&#x7CFB;&#x5217;&#xFF0C;&#x4E00;&#x4E2A;&#x56FE;&#x8868;&#x53EF;&#x80FD;&#x5305;&#x542B;&#x591A;&#x4E2A;&#x7CFB;&#x5217;&#xFF0C;&#x6BCF;&#x4E00;&#x4E2A;&#x7CFB;&#x5217;&#x53EF;&#x80FD;&#x5305;&#x542B;&#x591A;&#x4E2A;&#x6570;&#x636E;</span>
                    name:<span class="hljs-string">&quot;&#x9500;&#x91CF;&quot;</span>,
                    type:<span class="hljs-string">&quot;bar&quot;</span>,
                    data:[<span class="hljs-number">2</span>,<span class="hljs-number">5</span>,<span class="hljs-number">12</span>]
                }]
            }

        <span class="hljs-comment">// &#x7B2C;&#x4E09;&#x6B65;&#xFF1A; &#x4F7F;&#x7528;&#x521A;&#x6307;&#x5B9A;&#x7684;&#x914D;&#x7F6E;&#x9879;&#x548C;&#x6570;&#x636E;&#x663E;&#x793A;&#x56FE;&#x8868;&#x3002;</span>
        myChart.setOption(option);
    </span><span class="hljs-tag">&lt;/<span class="hljs-title">script</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">body</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">html</span>&gt;</span>
</code></pre>
<p>&#x6D4F;&#x89C8;&#x5668;&#x8FD0;&#x884C;&#x6548;&#x679C;&#xFF1A;
<a href="case/1.html" target="_blank">&#x70B9;&#x51FB;&#x67E5;&#x770B;&#x6548;&#x679C;</a></p>
<p><img src="img/echarts1.png" alt="&#x793A;&#x4F8B;&#x56FE;"></p>
<p>&#x6B64;&#x65F6;&#x6211;&#x4EEC;&#x5C31;&#x5B8C;&#x7F8E;&#x7684;&#x5B8C;&#x6210;&#x4E86;&#x4E00;&#x4E2A;&#x7B80;&#x5355;&#x7684;&#x56FE;&#x8868;&#xFF0C;&#x4E0B;&#x4E00;&#x8282;&#x6211;&#x4EEC;&#x6765;&#x4ECB;&#x7ECD;&#x4E00;&#x4E0B;&#x7B2C;&#x4E8C;&#x6B65;&#x4E2D;&#x914D;&#x7F6E;&#x9879;&#x7684;&#x6BCF;&#x4E2A;&#x53C2;&#x6570;&#x5206;&#x522B;&#x4EE3;&#x8868;&#x4EC0;&#x4E48;&#x610F;&#x601D;&#xFF0C;&#x5E38;&#x7528;&#x7684;&#x5C5E;&#x6027;&#x6709;&#x54EA;&#x4E9B;&#xFF1F;</p>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../../md/echarts/lesson1.html" class="navigation navigation-prev " aria-label="Previous page: echarts的介绍"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../../md/echarts/lesson3.html" class="navigation navigation-next " aria-label="Next page: echarts常用组件"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../../gitbook/app.js"></script>

    
    <script src="../../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-livereload/plugin.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"livereload":{}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
